import { _decorator, Component, Node, director } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('MenuRoot')
export class MenuRoot extends Component {
  start() {
    // 预加载
    director.preloadScene('main', function () {
      console.log(`[Log] 预加载main场景完成-->`);
    });
  }

  update(deltaTime: number) {}

  startGame() {
    console.log(`[Log] startGame-->`);
    // 直接加载
    // director.loadScene('main', function () {
    //   console.log(`[Log] loadScene-->`);
    // });

    // 加载主场景
    director.loadScene('main');
  }

  onDestroy() {
    console.log(`[Log] onDestroy-->`);
  }
}
